package com.fise.localvideo.firstdemo;

import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.provider.MediaStore;

import java.text.SimpleDateFormat;
import java.util.Date;

public class LocalVideoInfo {

    private String name;//标题
    private String path;//路径
    private Bitmap thumb;//缩略图
    private String createdTime;//创建时间
    private String displayName; //展示名称
    private String displayDuration;//视频时长





    //private Date createdTime;//创建时间

    public LocalVideoInfo(String name,
                          String path,
                          String createdTime,
                          String displayName,
                          String displayDuration

                          ) {
        this.name = name;
        this.path = path;
        //this.thumb = thumb;
        //获取视频的缩略图
        //MINI_KIND表示小的缩略图；
        //FULL_SCREEN_KIND表示大尺寸的缩略图；
        //MICRO_KIND表示超小图的缩略图；
        this.thumb = ThumbnailUtils.createVideoThumbnail(path, MediaStore.Images.Thumbnails.MINI_KIND);

        SimpleDateFormat sf = new SimpleDateFormat("yy年MM月dd日HH时mm分");
        Date d = new Date(Long.valueOf(createdTime)*1000);
        this.createdTime = sf.format(d);
        this.displayName = displayName;
        this.displayDuration = displayDuration;
        //this.createdTime = createdTime;
    }


    public LocalVideoInfo(String name, String path,Bitmap thumb, String createdTime,
                          String displayName,
                          String displayDuration
                          ) {
        this.name = name;
        this.path = path;
        this.thumb = thumb;
        //获取视频的缩略图
        //MINI_KIND表示小的缩略图；
        //FULL_SCREEN_KIND表示大尺寸的缩略图；
        //MICRO_KIND表示超小图的缩略图；
        //this.thumb = ThumbnailUtils.createVideoThumbnail(path, MediaStore.Images.Thumbnails.MINI_KIND);

        SimpleDateFormat sf = new SimpleDateFormat("yy年MM月dd日HH时mm分");
        Date d = new Date(Long.valueOf(createdTime)*1000);
        this.createdTime = sf.format(d);
        this.displayName = displayName;
        this.displayDuration = displayDuration;
        //this.createdTime = createdTime;
    }







    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Bitmap getThumb() {
        return thumb;
    }

    public void setThumb(Bitmap thumb) {
        this.thumb = thumb;
    }

//    public Date getCreatedTime() {
//        return createdTime;
//    }
//
//    public void setCreatedTime(Date createdTime) {
//        this.createdTime = createdTime;
//    }

        public String getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(String createdTime) {
        this.createdTime = createdTime;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getDisplayDuration() {
        return displayDuration;
    }

    public void setDisplayDuration(String displayDuration) {
        this.displayDuration = displayDuration;
    }


    @Override
    public String toString() {
        return "LocalVideoInfo{" +
                "name='" + name + '\'' +
                ", path='" + path + '\'' +
                ", thumb=" + thumb +
                ", createdTime='" + createdTime + '\'' +
                ", displayName='" + displayName + '\'' +
                ", displayDuration='" + displayDuration + '\'' +
                '}';
    }
}
